<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            width: 1000px;
            height: 300px;
            margin-top: 20px;
        }
    </style>
    <script>
        window.onload = function () {
            var ele_input = document.getElementsByTagName("input");
            ele_input[2].onclick = function () {
                var n = Number(ele_input[0].value);
                var m = Number(ele_input[1].value);
                var i,j;
                arr=[];
                for (i = n; i <= m; i++) {
                    for ( j = 2; j <i; j++) {
                        if (i % j == 0) {
                            break;
                        }               
                    }
                    if (j == i){
                    arr.push(i)
                    } 
                }
             if(arr.length>0){
                document.querySelector(".box1").innerHTML = arr;
             }else {
                document.querySelector(".box1").innerHTML = "不存在素数";
             }
            }

        }

    </script>
</head>

<body>
    <form action="">
        <h1>求两个数之间的所有素数</h1>
        <input type="text" placeholder="请输入一个整数">到
        <input type="text" placeholder="请输入第二个整数">之间的素数
        <input type="button" value="确定">
    </form>
    <div class="box1"></div>
</body>

</html>